﻿// =====================================================================
// <copyright file="ExceptionExtensionsTest.cs" author="David R. Guindo">
// 	Copyright (C) 2013. All rights reserved.
// </copyright>
// =====================================================================
// This code is released under the terms of the Apache 2.0 license, 
// http://apache.org/licenses/LICENSE-2.0.html
// =====================================================================

namespace AppBlock.Core.Test.Extensions
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class ExceptionExtensionsTest
    {
        [TestMethod]
        public void ExceptionExtensions_GetStackHierachy_Test()
        {
            var ex = new Exception("A", new Exception("B", new Exception("C")));
            string result = ex.GetStackHierachy();
            Assert.IsNotNull(result);
            Assert.AreEqual("ABC", result.Replace(Environment.NewLine, ""));
        }

        [TestMethod]
        public void ExceptionExtensions_GetMessageHierarchy_Test()
        {
            var ex = new Exception("A", new Exception("B", new Exception("C")));
            string result = ex.GetMessageHierarchy();
            Assert.IsNotNull(result);
            Assert.AreEqual("ABC", result.Replace(Environment.NewLine, ""));
        }
    }
}